<?php

namespace App\Models;

use Cartalyst\Sentinel\Users\EloquentUser;

class User extends EloquentUser
{
    // use Authenticatable, Authorizable, CanResetPassword;

    /**
     * The database table used by the model.
     *
     * @var string
     */
    protected $table = 'users';

    protected $loginNames = ['username'];

    /**
     * The attributes that are mass assignable.
     *
     * @var array
     */
    protected $fillable = [
        'username',
        'password',
        'is_admin',
        'permissions',
        'last_login',
        ];

    /**
     * The attributes excluded from the model's JSON form.
     *
     * @var array
     */
    protected $hidden = [
        'password',
        'created_at',
        'updated_at'
        ];

    public function userInfo()
    {
        return $this->hasOne('App\Models\UserInfo', 'user_id', 'id');
    }

    public function adminInfo()
    {
        return $this->hasOne('App\Models\AdminInfo', 'user_id', 'id');
    }

    public function userDevices()
    {
        return $this->hasMany('App\Models\UserDevice', 'user_id', 'id');
    }

}
